<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <!-- {{}}  模版解析 -->
        <!-- 
        {{ str }}
        {{ arr }}
        {{ obj }} -->
        

        <!-- 指令  v-  操作dom结构 -->
        <!-- v-for (循环生成dom结构) -->
        
        <ul>
            <!-- 数字 -->
            <!-- <li v-for="(item, index) in num">
                {{ item }} --- {{ index }}
            </li> -->

            <!-- 字符串 -->
            <!-- <li v-for="(item, index) in str">
                {{ item }} --- {{ index }}
            </li> -->

            <!-- 数组 -->
            <!-- <li v-for="(item, index) in arr">
                {{ item }} --- {{ index }}
            </li> -->

            <!-- <li v-for="(item, index) in arr2">
                <p>
                    姓名: {{ item.name }}
                </p>
                <p>
                    年龄: {{ item.age }}
                </p>
            </li> -->

            <li v-for="item in arr2">
                <p>
                    姓名: {{ item.name }}
                </p>
                <p>
                    年龄: {{ item.age }}
                </p>
            </li>


            <!-- 对象 -->
            <!-- <li v-for="(value, key, index) in obj">
                {{ value }} ---  {{ key }}  ---  {{ index }}
            </li> -->

        </ul>
    </div>


    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script>
        new Vue({
            el: "#app",
            // 定义数据(状态)
            data: {
                str: "字符串",
                arr: [1, 2, 3, 4],
                arr2: [
                    {
                        name: "张三",
                        age: 20
                    },
                    {
                        name: "李四",
                        age: 30
                    },
                    {
                        name: "王五",
                        age: 40
                    }
                ],
                obj: {
                    name: "张三",
                    age: 20
                },
                num: 50
            }
        })
    </script>
</body>

</html>